#ifndef QUERY_HPP
#define QUERY_HPP

#include "routingindex.hpp"
#include "../../lib/protocol.hpp"

#include <string>
#include <vector>
#include <map>
#include <sys/time.h>

using namespace pipc;

class Query
{
public:
    Query();
    enum State {WINDOW, ACK, RETURN,DONE};
    State state;
    Query(std::string key, RoutingIndex index, struct timeval start);
    struct timeval latestAck();

    bool allAckRecieved();
    int64_t windowFrom(struct timeval);
    std::map<std::string, struct::timeval> subscribers;
    std::map<std::string, std::string> publishers;
    std::string key;
    struct timeval start;
};

#endif // QUERY_HPP
